<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:c="http://java.sun.com/jstl/core"
	  xmlns:sf="http://www.springframework.org/tags/faces"
	  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
	  xmlns:spring="http://www.springframework.org/tags"
	  contentType="text/html" encoding="UTF-8">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>
	<meta name="fragment" content="!"/>
	<!-- http://www.w3.org/2005/10/howto-favicon -->
	<link rel="icon" type="image/x-icon" href="${request.contextPath}/images/favicon_uefa.ico"/>
	<!--
	Dynamically changing favicons
	http://stackoverflow.com/questions/260857/changing-website-favicon-dynamically
	http://ajaxify.com/run/favicon/animate/
	http://remysharp.com/2010/08/24/dynamic-favicons/
    -->
	<script language="javascript">
		var targetDate = new Date(Date.parse("${nextTourBetsFinishedTime}"));
		//var targetDate = new Date(Date.parse("Jun 11, 2012 15:00:00"));
		var oneMinute = 60 * 1000;
		var oneHour = oneMinute * 60;
		var oneDay = oneHour * 24;
		
		function updateCountDown() {
		    var today = new Date();
		    var ms = Math.floor(targetDate - today.valueOf());
		    var output = "прием прогнозов прекращается через ";
		    var days, hrs, mins, secs;
		    if (ms >= 0) {
		        days = Math.floor(ms/oneDay);
		        ms -= oneDay * days;
		        hrs = Math.floor(ms/oneHour);
		        ms -= oneHour * hrs;
		        mins = Math.floor(ms/oneMinute);
		        ms -= oneMinute * mins;
		        secs = Math.floor(ms/1000);
		        if (days>0) 
			        output += days + " дн. ";  
		        if (hrs>0) 
			        output += hrs + " ч. ";  
		        if (mins>0) 
			        output += mins + " м. ";  
		        output += secs + " с.";
		    } else 
		        output = "";
			
			div=document.getElementById("timer");
			if (days>0)
				div.className="timerGreen";
			else
				div.className="timerRed";
			div.innerHTML = output;
		    setTimeout("updateCountDown()", 1000);
		}
		
		//Dynamically changing favicons
		//http://code.google.com/p/chromium/issues/detail?id=121333
		var faviconEl;
		(function() {
			if ("${configProperties['cup.org']}" == 'fifa') {
				if (faviconEl)
					document.head.removeChild(faviconEl);
				faviconEl = document.createElement('link');
				faviconEl.rel = 'icon';
				faviconEl.type = 'image/x-icon'; //required for chromium
				faviconEl.href = "${request.contextPath}/images/favicon_fifa.ico";
				document.head.appendChild(faviconEl);
			}
		})();
	</script>

	<title>${configProperties['cup.title']}</title>
	
	<!--<sf:includeStyles/>
	 <sf:resourceGroup>
		<sf:resource path="/css-framework/css/tools.css"/>
		<sf:resource path="/css-framework/css/typo.css"/>
		<sf:resource path="/css-framework/css/forms.css"/>
		<sf:resource path="/css-framework/css/layout-navtop-localleft.css"/>
		<sf:resource path="/css-framework/css/layout.css"/>
	</sf:resourceGroup> --> 
	<sf:resource path="/styles/zoo.css"/>
	<ui:insert name="headIncludes"/>
</head>
<body class="tundra spring" onload="updateCountDown()">
<div id="page">
	<div id="header" class="clearfix spring">
		<div id="welcome">
			<table border="0" width="100%"><tr>
			<td align="left"><table border="0" cellspacing="0" cellpadding="0"><tr><td align="center"><a href="${request.contextPath}/">Конкурс знатоков<br/>футбола<!--${configProperties['cup.title']}--></a></td></tr></table></td>
			<td align="center" id="timer"></td>
			<td align="right">
				<c:if test="${not empty currentUser.name}">
	            	Добро пожаловать, ${currentUser.name} | <a href="${request.contextPath}/action/logout">Выход</a>
				</c:if>
				<c:if test="${empty currentUser.name}">
	            	<a href="${request.contextPath}/action/login">Вход 
	            	1<h:outputText value="#{msg['common.login']}"/>1
	            	</a>
				</c:if>
			</td>
			</tr></table>
		</div>
		<div id="branding" class="spring">
			<table border="0" width="100%">
				<tr>
					<td align="left"><a href="${configProperties['cup.url']}" target="_blank"><img src="${request.contextPath}/resources/images/logo100x100.jpg" alt="${configProperties['cup.title']}"/></a></td>
					<td align="center">
						<a href="${configProperties['cup.url']}" target="_blank"><img src="${request.contextPath}/resources/images/logo650x60.jpg" alt="${configProperties['cup.title']}"/></a>
					</td>
					<td align="right"></td>
				</tr>
			</table>
		</div>
	</div>
	<div id="content" class="clearfix">
		<table border="0" width="100%">
		<tr>
			<td align="left" width="200px" valign="top">
				<table border="0" width="100%">
					<tr><td><a href="${request.contextPath}/">Главная страница</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/rules">Правила конкурса</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/bets">Мой прогноз</a></td></tr>
					<tr><td><a href="mailto:${configProperties['app.email']}?subject=message from site ${configProperties['app.url']}" target="_blank">Написать в оргкомитет</a></td></tr>
					<tr><td>&nbsp;</td></tr>
					<tr><td>&nbsp;</td></tr>
					<tr><td><a href="${request.contextPath}/action/result1">Результаты I тура</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/result2">Результаты II тура</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/result3">Результаты III тура</a></td></tr>
					<c:if test="${configProperties['cup.org'] == 'fifa'}">
						<tr><td><a href="${request.contextPath}/action/result4">Результаты 1/8 финала</a></td></tr>
					</c:if>
					<tr><td><a href="${request.contextPath}/action/result5">Результаты 1/4 финала</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/result6">Результаты 1/2 финала</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/result7">Результаты финала</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/groups">Места в группах</a></td></tr>
					<tr><td><a href="${request.contextPath}/action/winners">Призеры чемпионата</a></td></tr>
					<tr><td>&nbsp;</td></tr>
					<tr><td>&nbsp;</td></tr>
					<tr><td><a href="${request.contextPath}/history/2010/_wc2010.htm" target="_blank">Итоги WC 2010</a></td></tr>
					<tr><td><a href="${request.contextPath}/history/2008/_ec2008.htm" target="_blank">Итоги EURO 2008</a></td></tr>
					<tr><td><a href="${request.contextPath}/history/2006/_wc2006.htm" target="_blank">Итоги WC 2006</a></td></tr>
					<tr><td><a href="${request.contextPath}/history/2004/_ec2004.htm" target="_blank">Итоги EURO 2004</a></td></tr>
					<tr><td><a href="${request.contextPath}/history/2002/_wc2002.htm" target="_blank">Итоги WC 2002</a></td></tr>
				</table>
			</td>
			<td align="left" valign="top">
				<div id="main">
					<ui:insert name="content"/>
				</div>
			</td>
		</tr>
		</table>
	</div>
	<div id="footer" class="spring" align="right">
		<a title="developed by Andriy Churchyn and Pavlo Babachanakh">©Оргкомитет, 2010-2012</a> 
	</div>
</div>

</body>
</html>
</f:view>